home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / CHIP Turkiye Mart 1999.iso / 101 / araclar / the partition resizer 130 / Presz130 / PRESIZER.DOC < prev    next >
Text File  |  1998-11-05  |  44KB  |  863 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.             Partition Resizer v. 1.3.0
  10.             ==========================
  11.                 (c) Zeleps 1994-98
  12.                 ==================
  13.  
  14.  
  15.         Program's Manual and Technical Information
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. This file contains important information about the working and usage of
  27. Partition Resizer. Please read it carefully before using Partition Resizer.
  28. You MUST read README.1ST before running Partition Resizer.
  29.  
  30. DISCLAIMER:
  31. This program is freeware. You may freely copy it and distribute it,as long as
  32. it remains unchanged and it is distributed with its original documents files.
  33. The author is not responsible for any consequence of the use or missuse of
  34. this program. Using this program is completely at your own responsibility.
  35.  
  36. 1- What is Partition Resizer
  37.  
  38.    1.1 Why you need Partition Resizer
  39.    1.2 How does it work?
  40.    1.3 Is it safe?
  41.    1.4 Changes made to the previous version
  42.  
  43. 2- Working with Partition Resizer
  44.  
  45.    2.1 Safety precautions
  46.    2.2 Running the program: What does what
  47.  
  48. 3- Technical matters
  49.  
  50.    3.1 The partition system
  51.    3.2 The DOS (FAT16 and FAT12 only) filesystem structure
  52.    3.3 The Windows FAT32 filesystem structure
  53.  
  54. 4- Partitioning Techniques
  55.  
  56.    4.1 Deciding what you want
  57.    4.2 Merging many small partitions into a larger one
  58.    4.3 Splitting a partition in two
  59.    4.4 Playing with partitions' sizes and positions
  60.  
  61. 5- Credits and addresses
  62.  
  63.                 -------||-------
  64.  
  65. 0- A short note from the author
  66.  
  67. It's been two years since the last release of Partition Resizer (v.1.1.2).
  68. Many of you probably lost my traces, since my e-mail address expired and
  69. I didn't continue my subscription (one of the reasons for that was the
  70. annoyingly large flow of Partition Resizer related e-mails), and I had to
  71. leave my home address for a certain period of time (I suppose I lost some
  72. correspondance concerning Partition Resizer because of that).
  73. Due to lack of time, I didn't really had the opportunity to upgrade the
  74. program all this time. But now that FAT32 is out there, I felt it was
  75. necessary to make the effort and produce the long awaited new version.
  76. So, here it is, Partition Resizer at its best, no known bugs (3 years of
  77. feedback was more than enough), full FAT32 support, updated documentation
  78. (not much really, but I did my best), and as always, free for everyone to
  79. use and enjoy!
  80.  
  81. Please note that, from this point over, wherever DOS is referenced, the
  82. same reference applies to Windows as well, unless explicitly stated
  83. otherwise.
  84.  
  85. 1- What is Partition Resizer
  86.  
  87.    1.1 Why you need Partition Resizer
  88.  
  89. OK, this is simple: if you have a disk partition (or more), and you want to
  90. change its size or position for any particular reason whatsoever, you have
  91. 3 options:
  92.  
  93. a) Backup everything, use FDISK to delete the partition, re-create the
  94. partition and restore the data.
  95.  
  96. b) Pay $60 to buy a program that you will use 3 times in your life ($20 per
  97. use)
  98.  
  99. c) Use Partition Resizer
  100.  
  101. Always remember: This program does not intend to replace FDISK. It's rather
  102. complementary to it. You will still need FDISK if you want to create and
  103. delete partitions. Partition Resizer processes only existing partitions.
  104. Also, Partition Resizer does not convert FAT16 (older DOS partitions) into
  105. FAT32. Windows 98 provides a tool that does this conversion.
  106.  
  107.  
  108.    1.2 How does it work?
  109.  
  110. Well, this is the tricky part. The details are described in section 3, but
  111. I'll try to make a start from here. I assume that everybody understands the
  112. importance of partitioning. I also assume that most of you understand how
  113. partitioning is achieved. For those who don't, here it is:
  114.  
  115. Partitioning is just a marking of territories on the physical disk's surface.
  116. At the first sector of the disk (sector 1, head 0, cylinder 0) resides an
  117. executable code block, which looks for the bootable partition, and runs
  118. it's boot sector code. That sector contains the information needed to
  119. divide the disk space into partitions. Later on, the boot sector (which is
  120. created by the OS's format utility) loads the OS Kernel (in DOS's case it
  121. loads the IO.SYS and the MSDOS.SYS), which continues the job by loading
  122. the information of all the partition structure into memory.
  123.  
  124. Partition Resizer does two things: When moving, apart from moving the data,
  125. it changes the information contained in the partition structure. When
  126. resizing, it changes the file system's data, which is contained in the
  127. boot sector and the FAT area. Both partition and FAT FS structures are
  128. explained at section 3.
  129.  
  130.  
  131.    1.3 Is it safe?
  132.  
  133. I have not heard of any case where version 1.2.0 (previous version) caused
  134. damage to a disk. This version also appears to work fine but even if the
  135. program has been tested with hundreds of partitions and partition
  136. combinations, and even if the program worked great till now, there might
  137. still be some incompatibilities or even bugs. In case you find a problem,
  138. please inform me ASAP. In order to avoid trouble, you should backup the most
  139. valuable data in your disk, those that cannot be replaced. If something
  140. happens, you'll only have to reinstall what's lost.
  141.  
  142. Most of the partition combinations this program has been tested with are
  143. combinations created with DOS's (or Windows') FDISK, or compliant to it. If
  144. you have created a partition structure which is not compatible with DOS, the
  145. program will most probably encounter problems and refuse to work with the
  146. offending disk in order to protect your data. The typical DOS partition
  147. structure is described later on in this document (section 3).
  148.  
  149. The program utilises a special recovery mechanism that allows resumption of
  150. the resizing or moving process even if it is interrupted by a reboot (most
  151. probably due to power failure). Without this recovery mechanism, if the
  152. program was interrupted during the resizing or moving process, it would be
  153. impossible to access the partition's data again. This program stores every
  154. single step, so it always knows what the last action was. For speed and
  155. safety reasons I use the CMOS's bytes 1,3 and 5 (the alarm bytes) to store
  156. the step counter number. Because the contents of the CMOS are preserved even
  157. when the power is off, the program can always find the last step and continue
  158. its work like nothing happened. If you don't believe it, test it.
  159.  
  160. There is one problem I do not prevent: Bad sectors. In case your disk has
  161. bad sectors, the program will not run, in order to protect your data. It will
  162. make a surface scan before it starts, but if you are certain that your disk
  163. is free of defects, you may skip it. It would be better if you had your disk
  164. surface scanned with a commercial program (like Norton Disk Doctor or
  165. Windows' ScanDisk) before you run Partition Resizer.
  166.  
  167. And note this: The program can be *really* dangerous, if you don't follow
  168. ALL precautions described in the README.1ST file. Please read it carefully
  169. before using the program.
  170.  
  171.  
  172.    1.4 Changes made to the previous version
  173.  
  174. -Documentation update
  175. -Various important speed optimisations
  176. -Completely new resizing and moving engine
  177. -Automatic resizing of the extended partition when necessary
  178. -Major interface update
  179. -Strict partition structure validity verification
  180. -Full support for Hard Disks up to 2TB (using Int13 Extensions)
  181. -Introduction of Command Line Parameters
  182. -Corrected the drive letter nomination problem with FAT16 partitions
  183. -Corrected the problem with changing the current directory
  184.  
  185.  
  186. 2- Working with Partition Resizer
  187.  
  188.    2.1 Safety Precautions
  189.  
  190. As with every program that messes with your data, you should be extra
  191. careful. It is not difficult to make a mistake that will cost you valuable
  192. data. So, you MUST follow carefully the instructions contained in the
  193. file README.1ST, in order to ensure data safety. It would be a good idea
  194. to print TROUBLE.DOC file in order to have it available when something
  195. wrong happens.
  196.  
  197.  
  198.    2.2 Running the program: What does what
  199.  
  200. The program will first look for the disk characteristics, it will scan the
  201. partition information, and it will identify and check all the DOS partitions
  202. of the disk. After some basic checks, it will continue with the main menu
  203. of the program. Here you have 4 choices.
  204.  
  205. The first is resizing/moving a DOS partition or an extended partition. This
  206. option will resize a partition in order to make free space for a new
  207. partition to be created. It will also grow a partition if there is
  208. unallocated space available and the cluster size is big enough. You can also
  209. move the partition in the empty space. This way you will be able to change
  210. the order of the partitions in the disk. You can also resize extended
  211. partitions.
  212.  
  213. The second option is used to change a FAT16 partition's cluster size. This
  214. will help you to make a small new partition able to grow up to any size you
  215. want. This option should be used ONLY on empty and formatted partitions,
  216. since it deletes all the data inside the partition.
  217.  
  218. The third option will show you detailed information for every partition on
  219. the disk. This may sometimes help you find out which partition you want to
  220. move or resize.
  221.  
  222. The last option will exit the program, and if you made any changes to the
  223. partition structure it will immediately reboot the machine, so that the new
  224. information will be loaded from the disk.
  225.  
  226. Every choice but 4, will lead you to a menu where you will be asked to choose
  227. the partition which should be modified. Just enter the partition's number
  228. and press enter. Every partition description can have up to four flags. The
  229. first flag can be either P,L or E. These letters stand for Primary, Logical
  230. and Extended partition respectively. The flag * shows that the specified
  231. partition can be resized. Only partitions with * can be resized. The flag #
  232. shows which partitions can be moved. The flag ! shows that a partition is
  233. incompatible with the program, therefore it cannot be moved or resized. All
  234. partitions can be moved, but this is not always safe. I have tried moving FAT
  235. and HPFS partitions successfully, but I cannot be sure for every partition
  236. type. If you decide to move any other partition type but FAT, you will be
  237. proceeding at your own risk. The Drive letter indicated for a partition is
  238. the one originally assigned by DOS. Usage of some software drivers, like
  239. DblSpace or Stacker might alter the original drive letters.
  240.  
  241. The user interface for resizing/moving partitions has been greatly simplified:
  242. appart from the use of graphics that make understanding the disk map easier,
  243. the most important functions of Partition Resizer are accessible through this
  244. screen. Using the Tab key, you can toggle between moving and resizing the
  245. currently selected partition. For advanced users, the space bar displays
  246. the extended partition of the disk and allows manipulation of its ends.
  247. By default, the extended partition is concealed, allowing the user to
  248. manipulate other partitions in a much simpler and effective way. Once
  249. finished, press enter to continue and accept the confirmation question.
  250.  
  251. The screen will now clear, and you will be asked whether you want to perform
  252. a surface test or not. This is not necessary if you know that your disk
  253. is free of defects or if you performed a surface test recently, since
  254. it will take some time (from several seconds to 15 minutes, depending on the
  255. size of the partition). If you are uncertain, perform the surface test, since
  256. bad sectors can be dangerous to your data. If the program finds any bad
  257. sectors, it will quit immediately. If the surface test concludes normally,
  258. the program will start performing the requested changes. This may take from
  259. a few seconds to a few hours, so be prepared. If the program is terminated
  260. abnormally, p.e. in case of a power shutdown, don't worry, you can always
  261. reboot and run the program again. It will continue exactly from the point it
  262. stopped. After it finishes, you may proceed with more changes, or exit the
  263. program, which will boot your machine.
  264.  
  265. Sounds easy? Well, it should be. But if you are confused, you better check out
  266. what's on the next section, just to get an idea about the whole partitioning
  267. system. If you still have questions, you can get help from friends, or contact
  268. me via my Internet addresses (see the end of this document). If you don't have
  269. access to Internet, you can send me a letter (postcard preferred) and I will
  270. try to help you as much as I can. Don't forget to tell me details about your
  271. system, your partitions, and send me a copy of the PRESIZER.LOG file.
  272.  
  273.  
  274.    2.3 Command Line Parameters
  275.  
  276. Partition Resizer's execution can be customized to suit your needs with the
  277. following command line parameters:
  278.  
  279. /drive:#    When scanning for available physical drives (hard disks),
  280.         Partition resizer will ignore all other drives except for the
  281.         one specified in this parameter. # stands for the drive
  282.         number (hard disk C: is number 0, D: is 1 and so on). For this
  283.         version of Partition Resizer, only one drive can be specified
  284.         each time the program runs.
  285. /killrescue    If Partition Resizer was interrupted while resizing a
  286.         partition, the next time it runs it will ask you to resume the
  287.         operation. If you DO NOT WANT Partition Resizer to EVER resume
  288.         the interrupted operation, use this option to permanently
  289.         delete the rescue file and cleanup. This is a DANGEROUS
  290.         parameter, since, if the resizing process is not resumed after
  291.         abnormal interruption, the partition that was being processed
  292.         (and in extreme cases other partitions as well) may be
  293.         completely trashed.
  294. /newlog         Creates an empty log file. By default, new log entries are
  295.         appended to the existing log. This option allows to overwrite
  296.         the existing entries.
  297. /noboot        This switch forces the program to exit without rebooting
  298.         after changes to the partition structure and/or file systems
  299.         have been made. This is a DANGEROUS option, since if the
  300.         user attempts to use the modified partition(s) before the
  301.         machine is restarted, major damage can occur to the data.
  302. /readonly    This switch allows the user to execute the program and modify
  303.         partitions (resize or move them) without actually making any
  304.         change whatsoever. The switch directly disables the disk
  305.         write routine which is the only part of the program that can
  306.         perform actual modifications to the disk. Therefore, this
  307.         switch can be safely used for testing purposes, since all
  308.         other functionallity (logging, rescue file creation etc.) will
  309.         be available. Warning: because of slight changes to the rescue
  310.         system, which now uses disk writing to extend the counter
  311.         range, in some extreme cases the resumption process may not
  312.         work correctly if this switch is specified. This is because
  313.         the overflowing digits of the counter will be ignored.
  314.         This has no impact on the disk integrity, but it may give
  315.         false results (resumption may start at a step earlier than
  316.         expected) IF the program is interrupted and the process is
  317.         resumed.
  318. /textmode    If you have any problems using the graphical interface, use
  319.         this switch to work with an alternative (and similar to the
  320.         graphic) interface in text mode. The text mode interface
  321.         still provides full functionallity, but visual aid is less
  322.         accurate and informative.
  323.  
  324.  
  325. 3- Technical Matters
  326.  
  327.    3.1 The partition system
  328.  
  329. The partition system is one of the most important things on the disk
  330. subsystem. It is a standard beyond File Systems and Operating Systems.
  331. The partition structure looks very much like the DOS directory structure.
  332. The root directory here is the root sector, the first sector of the disk.
  333. When the machine boots, bios loads this sector at address 7C00:0000,
  334. and jumps there. As you understand, there is code written at the beginning
  335. of that sector. This code searches the primary partition list to see which
  336. one is bootable, then loads its first sector (the boot sector) at the same
  337. address (7C00:0000) and it jumps there. After that, it is the operating
  338. system that takes control.
  339. Let's see some more details. Here is a detailed map of the root partition
  340. sector (sector 1, head 0, cylinder 0) (you may often see it as MBR, master
  341. boot record):
  342.  
  343. Offset             Description
  344.  
  345. 0x000-0x1BD        Boot code
  346. 0x1BE-0x1CD        First Primary partition descriptor
  347. 0x1CE-0x1DD        Second Primary partition descriptor
  348. 0x1DE-0x1ED        Third Primary partition descriptor
  349. 0x1EE-0x1FD        Fourth Primary partition descriptor
  350. 0x1FE-0x1FF        System Signature word (0xAA55)
  351.  
  352. Boot code is the executable code that was described above. The partition
  353. descriptors have the following form:
  354.  
  355. Offset             Description
  356.  
  357. 0x0                Boot marking
  358. 0x1                Head                    \
  359. 0x2                Sector & Cylinder 8-9    >  Starting location
  360. 0x3                Cylinder 0-7            /
  361. 0x4                System Description
  362. 0x5                Head                    \
  363. 0x6                Sector & Cylinder 8-9    >  Ending location
  364. 0x7                Cylinder 0-7            /
  365. 0x8-0xB            Relative sector
  366. 0xC-0xF            Number of sectors in partition
  367.  
  368. Boot marking is a byte value, which can be either 0 or the drive number
  369. (0x80). If it is 0x80 then the partition is the active partition of the
  370. disk (boot partition), and that's where the system boots from. The next
  371. 3 bytes contain the head, cylinder and sector where the partition begins.
  372. Sector and cylinder are stored in two bytes. Bits 0-7 of the cylinder
  373. value are stored in the second byte, while bits 8-9 are stored at the
  374. high bits of the first byte. The sector value is stored at bits 0-5 of the
  375. first byte. So, the word is bitmapped like this:
  376.  
  377. FEDCBA98 76543210
  378. CCCCCCCC CCSSSSSS
  379. 76543210 98543210
  380.  
  381. where C are Cylinder bits (the number below shows which cylinder bit is
  382. which) and S are Sector bits. Right after is the system byte, which is
  383. the identification byte for the partition. A value of 0 means that the
  384. partition is not being used, while other values depend on the file system.
  385. DOS uses values 1,4 and 6 for FAT12, FAT16 and BigDOS partitions respectively.
  386. A value of 5 means Extended partition, which is explained later on.
  387. Next, there is the ending location (sector) of the partition, and later on,
  388. the relative sector value. This is a number that shows the position of the
  389. partition relative to the present sector. So, for primary partitions, it's
  390. the starting sector of the partition (Primary partitions are the partitions
  391. that are described in the root of the partition structure. As we will see
  392. later on, there are partition descriptors in other places on the disk as
  393. well, which are called logical drives). The last item of the descriptor,
  394. is the partition length (in sectors).
  395.  
  396. When the disk is operating in LBA mode, the CHS (cylinder-head-sector) values
  397. for starting and ending location are ignored. Mapping of the drive is not
  398. done in terms of CHS but with an absolute sector number. Thus, relative sector
  399. value and partition length are used for identifying the partition's territory
  400. on the disk. For disks greater than 8.4GB in size, CHS values are always
  401. invalid.
  402.  
  403. In the root sector, there is space for 4 descriptors. Right after them, there
  404. is a word value of 0xAA55, which marks the sector as system sector. This
  405. value exists on every sector of the partition structure (including boot
  406. sectors) and if it doesn't exist, then the structure may probably be damaged.
  407.  
  408. Now, concerning extended partitions, they are described as any other partition
  409. in the root sector, but their treatment is different. These partitions are
  410. specifically treated by the Operating Systems. They point to a sector which
  411. contains partition descriptors for other partitions and extended partitions,
  412. and so on. This is how we can have more than 4 partitions on a disk. Let's
  413. see a small graphic (sic) example:
  414.  
  415. MBR     1st Ext         2nd Ext         3rd Ext
  416.        -----------------------------------------------------
  417. 1:p    | 1:l           | 1:l           | 1:l               |
  418. 2:p    | 2:e-----------| 2:e-----------| 2:-               |
  419. 3:e----| 3:-           | 3:-           | 3:-               |
  420. 4:p    | 4:-           | 4:-           | 4:-               |
  421.        -----------------------------------------------------
  422.  
  423. In this example, we see a map of a partition structure. MBR stands for
  424. Master Boot Record (root sector) and 1st, 2nd and 3rd Ext stand for
  425. 1st, 2nd and 3rd Extended partition nodes. 'p' stands for primary partition,
  426. 'e' stands for extended partition and 'l' stands for logical drive.
  427. The 'e' partition in the MBR, is called main or root or primary extended
  428. partition. This is because the whole extended partition structure is depending
  429. on that partition. Now, the starting location of the primary extended
  430. partition points to the 1st extended partition. The space that the primary
  431. extended partition allocates, is reserved for logical drives. The 1st
  432. extended partition (and the rest as well) contain information about their
  433. respective logical drives, in a way identical to the MBR (described above),
  434. but without the boot code part. Every extended partition has 4 descriptors
  435. as well, but only the first two are used: the first one identifies the
  436. corresponding logical drive, and the second contains and extended partition
  437. entry pointing to the next logical drive in the partition chain. So, the
  438. partition structure is a linked list structure, which can be as long as we
  439. like. (Every extended partition description sector has the 0xAA55 signature
  440. at its end, to identify it as a system sector).
  441.  
  442. There are some geometry restrictions for partitions. Partitions must start at
  443. the beginning of a cylinder, and end at a cylinder's end. This is that
  444. starting location must always be Cyl: XXXX  Head: (0 or 1)  Sector 1 and the
  445. ending location must be Cyl: YYYY  Head: k-1  Sector l, where k is the number
  446. of heads of the physical disk, and l the number of sectors per track of the
  447. physical disk. Also, if you delete one of the middle logical drives, (p.e.
  448. the 2nd Ext.) then the previous extended partition will be connected directly
  449. to the next, replacing the link. Geometry restricions are also effective in
  450. disks that work with LBA translation.
  451.  
  452. If you want to see the whole thing yourself, you can make your primary DOS
  453. partition smaller, and create some new logical drives just to play with
  454. them. You can get much help from a commercial Disk Editor, and you can of
  455. course play with Partition Resizer.
  456.  
  457.  
  458.    3.2 The DOS (FAT16 and FAT12 only) filesystem structure
  459.  
  460. The MBR executable code will load the boot partition's boot record. This
  461. is the second step of the booting procedure. And this is where the whole
  462. thing differs from OS to OS. We will only look at DOS's proceedings for now,
  463. since the rest OS's are less documented and more complicated (although on the
  464. next version of Partition Resizer I'll manage to resize OS/2 partitions, and
  465. if I get lucky enough, why not NTFS...).
  466.  
  467. The DOS partition is rather simple: The first sector is the boot sector,
  468. right after there are two copies of the FAT (File Allocation Table), right
  469. then we have 32 sectors for the root directory, and finally we have clusters
  470. 0 and 1 (unused) and later on the rest of the clusters.
  471.  
  472. The Boot record, is an executable code block, which is loaded by the MBR,
  473. and it makes some preparation in order to load the IO.SYS file, which is
  474. the DOS kernel (if we can call it a kernel... ;-)). This is useless to us,
  475. since only the processor can understand machine code, but the boot sector
  476. also contains useful information. This information begins at offset 3 of
  477. the sector and contains the following:
  478.  
  479. Offset            Description
  480. 0x03-0x0A         OEM ID: This is a small string written by the formatter.
  481. 0x0B-0x0C         Bytes per sector: This is always 512 (it depends on the
  482.           physical disks characteristics). If you have a disk with
  483.           a different value, please don't hesitate to inform me.
  484.           Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE
  485.           OTHER THAN 512!
  486. 0x0D              Sectors per Cluster: The cluster is the basic block of
  487.           information on a FAT drive. A FAT drive cannot have more
  488.           than 65527 clusters. This size can limit the maximum size
  489.           a partition can reach after resizing.
  490. 0x0E-0x0F         Reserved sectors at beginning: This is normally 1, the
  491.           boot sector. After these sectors, begins the FAT area.
  492. 0x10              FAT copies: Number of FAT copies. Normally there
  493.           are two copies of FAT.
  494. 0x11-0x12         Root directory entries: This is normally 512. This shows
  495.           the maximum number of files and directories that root
  496.           directory can hold. This is because the root directory has
  497.           a constant length (512 entries * 32 bytes/entry /
  498.           512 bytes/sector = 32 sectors)
  499. 0x13-0x14         Total sectors on disk (small): If we have less than 65536
  500.           sectors in the partition, this value contains the number.
  501.           If it's more, then the number is stored in bytes 0x20-0x23.
  502.           This is an entry that was left from the old DOS versions,
  503.           when partitions could have up to 65536 sectors.
  504. 0x15              Media descriptor byte: This byte is always F8 for hard
  505.           disks.
  506. 0x16-0x17         Sectors per FAT: This shows how many sectors does each FAT
  507.           take up. This depends on how many clusters the partition
  508.           has, and what is the FAT type (12bit/16bit). This can be
  509.           from 1 to 255 sectors.
  510. 0x18-0x19         Sectors per track: Same as the physical disk's sectors per
  511.           track value.
  512. 0x1A-0x1B         Sides: Same as the physical disk's head number.
  513. 0x1C-0x1F         Special hidden sectors: This is how many sectors exist
  514.           between the partition's description sector and the boot
  515.           sector. Usually one track.
  516. 0x20-0x23         Big total number of sectors: If we have more than 65536
  517.           sectors in the partition, their number is written here.
  518. 0x24-0x25         Physical drive number: This is the physical drive number
  519.           (c:0x80, d:0x81 etc.).
  520. 0x26              Extended boot record signature: This marks an extended
  521.           boot record. If it is 29, the disk was formatted by DOS
  522.           4.0 or later.
  523. 0x27-0x2A         Volume serial number: This is the partition's serial number.
  524. 0x2B-0x35         Volume label: This is the partition's label string.
  525. 0x36-0x3D         FS ID: This is a string that identifies a partition as
  526.           12bit FAT or 16bit FAT.
  527.  
  528. This is a detailed description of the boot record information. This will
  529. help you to understand more about the FAT file system.
  530.  
  531. The boot sector is the first sector of a DOS partition. The number of
  532. reserved sectors (which is normally 1) shows how many sectors we have before
  533. the FAT area. So in most cases, the first FAT sector is sector 2 of the
  534. partition (from now on, every sector number will be taken relatively from
  535. the beginning of the partition). The first FAT, who's length is given
  536. in the boot sector, contains entries that mark the partition's space
  537. allocation. Every file has a small descriptor of 32 bytes, which resides in
  538. its directory area (not in FAT). The directory area is itself a file, which
  539. is described in its parent directory, and so on until we reach root directory,
  540. which is a constant area in the partition (we'll see that later on). A word
  541. value in the file descriptor, tells DOS which is the file's first cluster.
  542. FAT consists of word values (or 12bit values if it is a 12bit FAT system),
  543. which begin from the first sector, and continue until the last one. Every
  544. value represents a cluster, which one is depending on the value's offset from
  545. the FAT's beginning. So, the 3rd word of the FAT stands for the 3rd cluster
  546. of the partition, and so on. So when DOS knows a file's first cluster, it's
  547. looking it up to find the value that is stored in the FAT's respective
  548. position. That value points to the next cluster of the file, and so on, until
  549. an EOF marking of 0xFFFF is found (0xFFF for 12bit FAT). Empty clusters are
  550. marked with 0 and bad clusters with 0xFFF7. This is how FAT works. Now, the
  551. first two positions of the FAT are reserved, and they have an identification
  552. code which is 0xFFFFFFF8 (0xFFFFF8 for 12bit FAT).
  553.  
  554. The rest FATs (2nd, 3rd etc.) are identical to the first one. They are
  555. exact copies of the first FAT, and they begin right after the end of the
  556. first FAT. Right after the last FAT, resides the root directory. This is
  557. normally 32 sectors long, and contains 32 byte entries which describe the
  558. root directory's files and directories. Right after the root directory,
  559. begins the first cluster (cluster 0) which is unused, and so is for cluster 1.
  560. Right after these two clusters, begins the user's space, where the files are
  561. stored.
  562.  
  563. This is the whole story about DOS's file system. This file system was designed
  564. to be fast (it's very easy to find the unallocated space) but it has certain
  565. disadvantages: One is the very large amount of unused space, which is caused
  566. by the use of clusters. For example, if you have a 340MB disk, you have to
  567. use 8192 bytes cluster size (16 sectors). This means that, if you write
  568. a file that is 1 or several bytes long, you will consume space of 8K. This
  569. could be resolved if we could use more than 65536 clusters in a DOS partition,
  570. which could mean a 20bit fat or more, in order to have clusters of 1 sector.
  571. Since this is not possible, there is another solution: Why should I have
  572. one partition with 8K cluster size, and not 2 partitions with 4K cluster size?
  573. The loss is lowered dramatically, and it would save many megs. This is not
  574. though always possible, since changing cluster size without loosing the
  575. existing data is quite complicated. I have decided not to add such
  576. functionality to the program, since the new Windows filesystem, FAT32,
  577. permanently solves the allocation problem. I strongly recommend the conversion
  578. of your existing FAT16 partitions into FAT32. This can be easily done with
  579. the use of the conversion utility provided by Microsoft and included in
  580. Windows 98 System tools collection.
  581.  
  582.  
  583.    3.3 The Windows FAT32 filesystem structure
  584.  
  585. The FAT32 filesystem is quite similar to the FAT16 filesystem. The following
  586. differences exist:
  587.  
  588. -FAT entries are now 32bit wide, allowing for a maximum of approximately 200
  589. milion clusters in a single partition (actually, each FAT entry is 28bit wide,
  590. the upper 4 bits are reserved for future use and must always be 0).
  591. -The boot sector's information has been changed (see the table below)
  592. -The root directory does not necessarily reside in the beginning of the drive
  593. and it can grow to any size desirable.
  594. -FAT mirroring can be disabled
  595.  
  596. In details, the boot sector entries are the following:
  597.  
  598. Offset            Description
  599. 0x03-0x0A         OEM ID: This is a small string written by the formatter.
  600. 0x0B-0x0C         Bytes per sector: This is always 512 (it depends on the
  601.           physical disks characteristics). If you have a disk with
  602.           a different value, please don't hesitate to inform me.
  603.           Partition Resizer WON'T WORK FOR DISKS WITH SECTOR SIZE
  604.           OTHER THAN 512!
  605. 0x0D              Sectors per Cluster: The cluster is the basic block of
  606.           information on a FAT drive. A FAT drive cannot have more
  607.           than 65527 clusters. This size can limit the maximum size
  608.           a partition can reach after resizing.
  609. 0x0E-0x0F         Reserved sectors at beginning: first FAT sector number
  610.           (0 based)
  611. 0x10              FAT copies: Number of FAT copies. Normally there
  612.           are two copies of FAT.
  613. 0x11-0x14         Reserved, must be 0.
  614. 0x15              Media descriptor byte: This byte is always F8 for hard
  615.           disks.
  616. 0x16-0x17         Reserved, must be 0
  617. 0x18-0x19         Sectors per track: Same as the physical disk's sectors per
  618.           track value.
  619. 0x1A-0x1B         Sides: Same as the physical disk's head number.
  620. 0x1C-0x1F         Special hidden sectors: This is how many sectors exist
  621.           between the partition's description sector and the boot
  622.           sector. Usually one track.
  623. 0x20-0x23         Big total number of sectors: If we have more than 65536
  624.           sectors in the partition, their number is written here.
  625. 0x24-0x27         Big Sectors per FAT value (old SPF value is now reserved).
  626. 0x28-0x29         Flags used for specifying FAT mirroring properties.
  627. 0x2A-0x2B         Major and minor version of the file system.
  628. 0x2C-0x2F         Root start: The first cluster (start) of the root directory.
  629. 0x30-0x31      File System sector number: offset of the file system sector
  630.           (see below).
  631. 0x32-0x33      Backup Boot Sector: offset of the backup copy of this
  632.           sector.
  633. 0x34-0x3F      Reserved.
  634. 0x40              Physical drive number: This is the physical drive number
  635.           (c:0x80, d:0x81 etc.).
  636. 0x41          Reserved.
  637. 0x42              Extended boot record signature: This marks an extended
  638.           boot record. If it is 29, the disk was formatted by DOS
  639.           4.0 or later.
  640. 0x43-0x46         Volume serial number: This is the partition's serial number.
  641. 0x47-0x51         Volume label: This is the partition's label string.
  642. 0x52-0x59         FS ID: This is a string that identifies a partition as
  643.           FAT32.
  644.  
  645. After this boot sector, the File System Sector exists, containing the
  646. following information:
  647.  
  648. 0x1E8-0x1EB      Free cluster count: contains the number of free clusters
  649.           in the drive (used to speed up free space calculation). If
  650.           it is -1 the value is recalculated.
  651. 0x1EC-0x1EF      First free cluster: number of the first available cluster
  652.           in the partition.
  653.  
  654. I will not go into more detailed explaination of the FAT32 file system. For
  655. more information, please visit the Microsoft Developers Library at
  656. http://www.microsoft.com/msdn and go to SDK Documentation - Platform SDK -
  657. Windows Base Services - Windows 95 Features - Windows 95 Reference -
  658. FAT32 API Reference - Structures.
  659.  
  660.  
  661. 4- Partitioning Techniques
  662.  
  663.    4.1 Deciding what you want
  664.  
  665. Well, OK, you've got the program. But now what happens? Where will you
  666. create the proper space for a new partition? And which partition is the one
  667. you want to shrink or grow? How should you place the partitions in the
  668. empty space to order them as you like? How will you grow a partition which
  669. refuses to grow more?
  670.  
  671. First of all, you have to decide what you want. Take a look at the partition
  672. list that FDISK or Partition Resizer provide you. Decide which partitions
  673. you need to resize. You may recognise them by their size, drive letter or
  674. serial numbers. Then you'll have to think what the new sizes will be. Remember
  675. that what's inside the extended partition cannot get out of it, and what's
  676. outside cannot get inside either.
  677.  
  678. Now, here are some useful techniques to use in certain situations. Just take
  679. a look to see if they meet your needs.
  680.  
  681.  
  682.    4.2 Merging many small partitions into a larger one
  683.  
  684. Sometimes, you get your disk divided into three or four partitions, which
  685. is not a useful thing. Until now, the only solution was to backup all
  686. your data, delete the whole partition structure, and then create a large
  687. partition to put your data inside. Partition Resizer can resolve the
  688. problem without any backing up. It's much faster and easier. Just do the
  689. following:
  690.  
  691. a. Decide which partition will be the one to remain. Normally, you should
  692. choose a primary partition. The problem is if it can grow enough. Decide
  693. what is the size the partition will finally grow to, and check if your
  694. primary partition can grow to that size. If it can't, go to step b, otherwise
  695. read step c.
  696.  
  697. b. If you want to create a partition that can grow enough for your needs,
  698. you will have to empty your primary partition. To do this, you have to
  699. shrink it to its minimum, while growing a logical drive. This can be done by
  700. shrinking the primary partition, expanding downwards the extended partition,
  701. moving the first logical drive to the beginning of the extended partition,
  702. and growing it to the max. Then, exit the program, move as much files as you
  703. can from the primary partition to the grown logical drive, defrag the
  704. primary partition, and repeat step b until the primary partition is empty.
  705. When you empty it, use the program to change its cluster size that matches
  706. your needs. You can provide the program with the desired size, which is the
  707. size you want the partition to have when you finish the whole process.
  708. Partition Resizer will then suggest you a cluster size to apply to the
  709. partition, which is the optimum size for the given desired partition size.
  710. If this was your boot partition, you will have to make it a system partition
  711. again, so run SYS to do that.
  712.  
  713. c. Now that your primary partition is able to grow enough, start moving
  714. data into it. Try to get data from small partitions, so that you can
  715. finish with them early and get rid of them. If you filled up the primary
  716. partition and there's still data in the partition which you are emptying,
  717. move data from the emptying partition to other partitions, in order to
  718. empty it faster. When the partition is empty, you can delete it with FDISK.
  719. If you cannot empty it, then defrag it, shrink it to its minimum, and move
  720. it to the end of the empty space created, grow the previous partition to
  721. reclaim the empty space created, exit the program, and move the rest of the
  722. data remaining into the grown partition. Repeat this until you empty the
  723. partition, and then delete it with FDISK.
  724.  
  725. d. One of the small partitions is now deleted. You can now move all the
  726. other logical drives to the end of the empty space, and resize the extended
  727. partition in order to make more space to grow the primary partition. Then
  728. choose another partition and repeat step c until you empty and delete all the
  729. logical drives. With the last one, you can delete the extended partition
  730. too. And presto! You can now grow the primary partition to fill all the
  731. empty space in the disk.
  732.  
  733.  
  734.    4.3 Splitting a partition in two
  735.  
  736. This technique is much alike the previous one. Suppose you have one primary
  737. partition, and you want to split it in two partitions. This is faster and
  738. easier than the previous procedure, just do the following:
  739.  
  740. a. Defrag the primary partition, and then shrink it to the minimum. This way,
  741. you will create empty space for the new partition.
  742.  
  743. b. Using FDISK create an extended partition, and then a logical drive in it.
  744. Format the logical drive, and run Partition Resizer. You will now have to
  745. decide the final size of the new partition, in order to change its cluster
  746. size while it is still empty. When you decide the final size, choose the
  747. third option of Partition Resizer's main menu, and give as desired size the
  748. size you decided. The program will suggest you a cluster size that is optimum
  749. for the partition, and you should apply that size.
  750.  
  751. c. When you finish creating and modifying the new partition, exit the program,
  752. and move the data you want in the new partition. Then, shrink the primary
  753. partition again (defraging is necessary here) grow the logical drive to the
  754. maximum. Repeat this step, until you reach the desired size.
  755.  
  756.  
  757.    4.4 Playing with partitions' sizes and positions
  758.  
  759. And now, some general advice about partition resizing:
  760.  
  761. a. When shrinking a partition, always defrag it first. This will leave
  762. space at the end of the partition, which will be freed by the program. The
  763. less space you have at the end of the partition, the less the shrinking will
  764. be. When defraging take special care for the unmovable files: They must be
  765. moved too, so change their attributes before defraging the disk. System
  766. files are a special case of unmovable files. You must be extra careful with
  767. these. Check the TROUBLE.DOC to see more info about the system files.
  768.  
  769. b. Although Partition Resizer can move primary partitions, you will rarely
  770. need to do this. You should always leave your DOS primary partitions in their
  771. original place, unless you absolutely need to move them. This will not harm
  772. the partition, but it might leave unused space before the primary partition
  773. which will never be used by DOS's FDISK. Warning: if you move a primary DOS
  774. partition, you might not be able to boot from that partition!
  775.  
  776. c. If you want to install a new operating system, you may have to delete
  777. much of your data in the DOS partition, since you cannot move that data in
  778. the new partition. So, you will only have to shrink your DOS partition once.
  779.  
  780. d. Always follow the safety rules described in README.1ST. Playing with your
  781. data can be REALLY dangerous sometimes, so be very careful.
  782.  
  783.  
  784.    4.5 Lack of features and possible workarounds
  785.  
  786. Partition Resizer required a lot of time for its development and the
  787. development of its upgrades. Time which was spent solely by me, and which is
  788. of course valuable. I never regret the time I spent on this project, and I
  789. feel that my efforts have been paid off by the success of the program in an
  790. international level.
  791.  
  792. There are though some features that Partition Resizer always lacked, and will
  793. probably continue to lack, because I believe that they are not necessary or
  794. workarounds can be used instead, while the time and effort they require for
  795. development is more than what I can invest (or am willing to invest). These
  796. features and possible workarounds are the following:
  797.  
  798. Problem:     Partition Resizer does not resize non-FAT partitions.
  799. Workaround:    Nothing I can think of... another program maybe?
  800.  
  801. Problem:    Partition Resizer does not change the cluster size in a
  802.         non-destructive way.
  803. Workaround:    Several workarounds exist. The best in my opinion, that is
  804.         of course if it can be applied, is to change the filesystem
  805.         to FAT32. This will create partitions with minimal cluster
  806.         sizes (4K) and practically unlimited maximum size. If FAT32
  807.         is not available, then try creating a new partition of the
  808.         desired cluster size, and move the data in there (see
  809.         PRESIZER.FAQ for a more detailed description of the process)
  810.  
  811. Problem:    Partition Resizer does not perform creation or deletion
  812.         of partitions.
  813. Workaround:    FDISK does. Please use it.
  814.  
  815. Problem:    Partition Resizer's user interface sucks.
  816. Workaround:    Pretend that you like the user interface.
  817.  
  818.  
  819. 5- Credits and addresses
  820.  
  821. There used to be a huge list of thanksgivings here, but I decided that it
  822. will take ages to update it (especially after 2 years). So I will briefly
  823. (but not less intensively) thank all of the people who helped the creation
  824. and continuous development of this program, with their suggestions, their
  825. feedback, and most of all their support that comes from the appreciation of
  826. my work.
  827.  
  828. I also thank you, for spending the time to read this document and for
  829. using my program. I hope that the technical info included in here will
  830. seriously help many of you to create your own programs. If you find this
  831. program useful, you can always send me a postcard to the following address:
  832.  
  833.     John Lagonikas
  834.     17 Lycourgou Str.
  835.     16675 Glyfada
  836.     ATHENS, GREECE
  837.  
  838. Since the e-mail flow concerning the program is always increasing, and reached
  839. a peak of several messages per day that had to be answered in detail, I would
  840. kindly request that you think twice before asking for advice or information.
  841. So, please, before sending the message, take a look at PRESIZER.FAQ to see if
  842. the answer to your questions (or your prayers) is in there. Please try to find
  843. some different passive sources (web pages, documentation, books etc.) that
  844. might help solving your problem. If all else fails, try contacting me at the
  845. address:
  846.  
  847.     zeleps@usa.net
  848.  
  849. Commentary e-mail is welcome, but it will probably not be answered.
  850.  
  851. The official home page of Partition Resizer is currently (28/10/98) located
  852. at:
  853.  
  854.     http://members.xoom.com/Zeleps
  855.  
  856. If you cannot find the page at this location for any reason, you can perform
  857. a Web search with the keywords "Partition Resizer Zeleps" to locate it.
  858.  
  859.  
  860. Thank you again for reading this document and for using Partition Resizer!
  861.  
  862.                    ------||------
  863.